<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html,body{
            height:100%;
            padding: 0;
            margin: 0;
        }
        #box{
            height: 100%;
        }
        #control{
            position: absolute;
            top: 0;
            left: 0;
            z-index: 99;
        }
    </style>
</head>
<body>
    <div id="box">
    </div>
    <!-- <div id="control">
        <ul>
            <li onclick="drawRect()">矩形</li>
        </ul>
    </div> -->
</body>
<script src="http://192.168.80.70:5500/imgDrawLite.js"></script>
<!-- <script src="./imgDraw.js"></script> -->
<!-- <script src="./DrawEnca.js"></script> -->
<script src="./data/encaData3.js"></script>
<script src="./data/encaData4.js"></script>
<script src="./data/pcbData.js"></script>
<script src="./data/pcbData2.js"></script>
<script src="./data/pcbData4.js"></script>
<script src="./PCBDraw.js"></script>
<script>
    // console.log(test())
    // a.getPins(["b","bs_t","bs_b","bp_t","bp_b","t","ts_t","ts_b","tp_t","tp_b","i","is_t","is_b","ip_t","ip_b","drill"]);
    // a.getLayer(["st","sb","at","ab","sm_t","sm_b","et","eb","bt","bb","pt","pb"]);
    // function drawRect(){
    //     console.log("绘制");
    //     a.drawRect();
    // }
    // console.log(a)
    // function setData(encaData){
    //     var a = new DrawEnca({
    //         encaData:encaData,
    //         parent:"#box",
    //         grid:true,
    //         edit:true
    //     });
    //     a.setLayersDraw(["st","sb","at","ab","sm_t","sm_b","et","eb","bt","bb","pt","pb"],["b","bs_t","bs_b","bp_t","bp_b","t","ts_t","ts_b","tp_t","tp_b","i","is_t","is_b","ip_t","ip_b","drill"]);
    //     console.log(a)
    // }

    // if(navigator.serviceWorker){
    //     let worker = navigator.serviceWorker.register("sw.js");
    //     worker.then(res=>{
    //         console.log(res);
    //     }).catch(err=>{
    //         console.log(err);
    //     })
    // }
    
    // var enca = new Encapsulation(encaData3);
    // var enca = new DrawEnca();

    // enca.setEncaData(encaData3);

    // enca.drawTo(document.querySelector("#box"));

    // enca.draw();


    // function handlePcb(pcbData){
    //     let encaData = {};
    //     let devices = pcbData.DevicesDefinition;
    //     let encaInstance = [];
    //     pcbData.ElementInstance.components.forEach(encaLoca=>{
    //         /*
    //             choose: 40
    //             layer: "bottom"
    //             name: "X3"
    //             rotate: 180
    //             x: 2881.49
    //             y: 8430.18
    //         */
    //        let enca = null;
    //         if(encaData[encaLoca.choose]){
    //                 enca = encaData[encaLoca.choose];
    //         }else{
    //             encaData[encaLoca.choose] = {};
    
    //             let device = devices.find(dev=>dev.id == encaLoca.choose);

    //             enca = device.Footprint.find(en=>en.id == device.choose);
    
    //             encaData[encaLoca.choose] = enca;
    //         }
    //         if(!enca){
    //             throw "未找到对应的封装信息";
    //         }

    //         encaInstance.push(new Encapsulation(enca, encaLoca));

    //     });
    //     return encaInstance;
    // }





    
    // let start = performance.now();
    // let drawPCB = new DrawPCB(pcbData4);
    // drawPCB.drawTo(document.querySelector("#box"));
    // drawPCB.goCenter();
    // drawPCB.draw();
    // console.log(performance.now() - start,drawPCB)
</script>
 </html>